package com.java.mk.weather;

import java.util.Observable;
import java.util.Observer;

public class Display2 implements Observer, DisplayElement {

    private Observable observable;

    private float temperature;

    private float pressure;

    public Display2(Observable observable) {
        this.observable = observable;
        observable.addObserver(this);
    }

    @Override
    public void dispaly() {
        System.out.println("display2 a+c=" + this.temperature + this.pressure);
    }

    @Override
    public void update(Observable obs, Object arg) {
        if (obs instanceof WeatherData) {
            WeatherData weatherData = (WeatherData) obs;
            this.temperature = weatherData.getTemperature();
            this.pressure = weatherData.getPressure();
            dispaly();
        }

    }
}
